//
//  WCNDayCell.m
//  WCNEffectServiceTimeVC
//
//  Created by wsj2015 on 15/12/14.
//  Copyright © 2015年 wsj2015. All rights reserved.
//

#import "WCNDayCell.h"
#import "WSJAnimationTool.h"



@implementation WCNDayCell

- (void)awakeFromNib {
    // Initialization code
    
    self.bgView.layer.cornerRadius = 10;
    self.bgView.layer.masksToBounds = YES;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
}

+ (instancetype)cellForTabelView:(UITableView *)tableView
{
   static NSString *cellId = @"dayCellId";
    WCNDayCell *cell =[tableView dequeueReusableCellWithIdentifier:cellId];
    if (nil ==cell) {
        cell = [[NSBundle mainBundle] loadNibNamed:@"WCNDayCell" owner:nil options:0].lastObject;
         cell.contentView.transform = CGAffineTransformMakeRotation(M_PI / 2);
    }
    
    return cell;

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
   
    if (selected) {
        self.bgView.backgroundColor = [UIColor redColor];
        self.dataLabel.textColor = [UIColor whiteColor];
        [WSJAnimationTool animationMoveDown:self duration:0.35f];
    }else{
         self.bgView.backgroundColor = [UIColor clearColor];
         self.dataLabel.textColor = [UIColor blackColor];
         [WSJAnimationTool animationPushUp:self];
        
    }
    
}
-(void)setDateModel:(WCNYearDate *)dateModel
{
//    "date": "2016-01-04",
//    "weekDayId": 1
   NSArray *titleArray =@[@"一",@"二",@"三",@"四",@"五",@"六",@"日"];
    _dateModel = dateModel;
    
    NSString *week =titleArray[[dateModel.weekDayId integerValue] -1];
    NSString *day = [dateModel.date substringFromIndex:5];
    self.dataLabel.text =[NSString stringWithFormat:@"周%@\n%@",week,day];

}

@end
